home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / Macintosh Drag and Drop / Demo Applications / FinderDrag / README < prev    next >
Encoding:
Text File  |  1995-06-09  |  2.8 KB  |  56 lines  |  [TEXT/MPS ]

  1.  
  2. FinderDrag - 
  3.  
  4. CHANGES SINCE 1.0.
  5.  
  6. The biggest change is that the code now uses the Apple Event Manager to pull
  7. the individual icons from the 'ifam' AEDesc returned by the Finder.  The 
  8. previous version actually walked the AEDesc handle and BlockMove'd the data
  9. into Handles.  I know, this is bad and I feel just terrible about the whole 
  10. thing…  So this code now coerces the ifam into an AERecord and uses
  11. AEGetKeyPtr(..., iconType, iconType, ...) to obtain the data.  I've noticed
  12. that I'm getting a much more restful sleep since making this change.
  13.  
  14. Nitin Ganatra, 5/95
  15.  
  16. --------------------------------------------------------------------------
  17.  
  18. This actually demonstrates how to do a few different things involding
  19. the Drag Manager and Finder Events:
  20.  
  21. 1. FinderDrag demonstrates one way to deal with performing certain tasks
  22. when a drag is received.  It is not possible to do a few things from
  23. tracking/receive handlers (for example, call WaitNextEvent when a  minor
  24. switch could take place, or call AESend and wait for a reply).   Another
  25. annoyance is that you cannot debug tracking/receive handlers from a 
  26. source level one machine debugger.  This application demonstrates how to
  27. package up the contents of a receive and send it back to the application
  28. via an AppleEvent.  Note that if you need to do things like call a 
  29. routine that gives up control to other processes, you must always
  30. send the event to yourself through your main event loop.  If you're
  31. using this method just to allow you to debug a complex receive handler,
  32. you can send yourself the Apple Events through your main event loop while
  33. debugging, and once you're done you can use direct dispatch AppleEvents.
  34. For more information check out the SendToSelf Tech note (in Processes).
  35.  
  36. 2. FinderDrag demonstrates how to check that the scriptable Finder is 
  37. present, and how to send Apple Events to it.  In particular, this 
  38. demonstrates how to get an icon family for a file system object.  
  39. Unfortunately, there is no API for picking apart an 'ifam' AEDescriptor
  40. that's sent back to you, so you need to do it by hand (as done in this
  41. sample).
  42.  
  43. 3. It demonstrates how to keep a reference to an existing HFS object, and
  44. how to move it around in the Finder's heirarchy using Finder Events.  This
  45. code is a bit ugly because of some bugs in the Finder, but this is the
  46. best way to do it for now.  Hopefully a future version of the Finder will
  47. allow you to simply drag hfsFlavor objects from one folder to another..  
  48. For now you need to create a promise HFS flavor, and when the send data proc
  49. is called, create a dummy file in the directory specified by the Finder.
  50. Then after the call to TrackDrag completes and if the drag was successful, 
  51. delete the dummy file and move the file(s) specified by hand to their
  52. new location.
  53.  
  54. This sample compiles under MetroWerks and MPW.
  55.  
  56. by Nitin Ganatra, 3/95